-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable Substitution: Options for enabling substution in command strings & for applying {fmt}-style number formatting #3220
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supporting string substitution for the event string arg sounds a bit insane xD. But it could be useful (and faster than always doing a round trip through a String Variable).
I think I cannot accept this without additional unit tests to verify that the fmt-style args work properly.
Minor: Bit unfortunate that this requires always copying com.string
even when the evaluation is disabled. I wonder if this can be prevented 🤔
Oh, haven't thought about the reference not working there. Stupid me. I'm working on an extensive test suite for my three main branches, which hopefully will cover all sorts of use cases: |
…for command code evaluation inside interpreter command strings
…riant which parses {fmt}-style format strings
…ed std::string instead of creating a copy
67d138d
to
b9ea8ad
Compare
1 request + 1 observation:
|
This PR enables two new features:
just write the format specification after a ':'
the parser will ignore anything that is not valid fmt syntax (also decimal types & 'precision' are not supported)
These two features require setting new liblcfs fields which are specified as follows:
Example: Graphics customization
Consider you want to dynamically change an actor graphic or faceset depending on some settings.
With this branch you can just use any pre-existing command like this:
com.string: "Actor\v[123:02d]"
... which evaluates to "Actor01.png", "Actor02.png", ..., "Actor[xx].png" depending on the value of Variable '123'